<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        function Gbw() { };
        Gbw.prototype.car = '玛莎拉蒂';
        Gbw.prototype.house = '外滩18号';

        function FatherGtw(name) {
            console.log(this);
            this.name = name
        }
        // 
        function F() { };
        // 隔离Gbw和FatherGtw 避免子类影响父类，进而影响其他子类，造成数据混乱
        F.prototype = Gbw.prototype;
        // new F() 等到的是一个F的实例，是一个空对象
        FatherGtw.prototype = new F();
        FatherGtw.prototype.constructor = FatherGtw;
        var son1 = new FatherGtw('高衙内');
        console.log(son1);
        FatherGtw.prototype.car = 'BMW';
        console.log(FatherGtw.prototype);
        console.log(Gbw.prototype);
    </script>
</body>

</html>